package com.liangZiVip.regionalAgentSystemApi.product.controller;

import com.alibaba.fastjson.JSON;
import com.liangZiVip.regionalAgentSystemApi.common.ResponseCode;
import com.liangZiVip.regionalAgentSystemApi.common.ResponseEntity;

import com.liangZiVip.regionalAgentSystemApi.product.entity.Product;
import com.liangZiVip.regionalAgentSystemApi.product.service.ProductServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private ProductServiceImpl productServiceImpl;


    @RequestMapping("/list")
    @ResponseBody
    public ResponseEntity list(Integer pageNo,Integer pageSize){

//        Map<String,Integer> d = new HashMap();
//        d.put("pageNo", pageNo);
//        d.put("pageSize", pageSize );

        Product p =  productServiceImpl.selectByPrimaryKey("22");

        ResponseEntity r = new ResponseEntity(ResponseCode.SUCCESS,p);

//        Object j =JSON.toJSON(r);
//        String js = JSON.toJSONString(r);
//        System.out.printf(js);

        return r;
    }
}
